Personally, I think that staying in an unhappy relationship "for the sake of the kids" is one of the most selfish things a parent can actually do. As others have pointed out, far more eloquently than I, staying when you don't love, respect, or trust the person you chose to bring children into the world with... fucks those children up! For life! Philip Larkin had it spot on when he said about how parents fuck their children up - and he lived in an era where marriages were meant to last for life.
My mother stayed with my father, having left him when I was 3. He had an affair, she found out, packed a suitcase when he was at work one day, took me out of playgroup early and we caught a train to the other end of the country, where my grandparents and brothers lived. I have absolutely no recollection of this whatsoever - I would simply have thought we were having a little holiday. DB2 remembers it vividly, however, as he was 13 at the time - my grandparents refused to help my mother, kept saying she'd "made [her] bed and now had to lie in it"... and after a few days, we went back to my father again. Their marriage has been absolutely miserable ever since. When I was 3, they'd been married for 8 years. They "celebrate" 50 years of marriage next month. And my childhood? Their shining example of marriage, handed down to not only myself but also my brothers? Is the reason why I will never get married. Ever. I'd not wish to inflict it upon my children. I've always walked away from a relationship if I was unhappy in it. And yes; I know not everyone has the strength to do that - my mother, for instance... but she had the excuse that this was the late '70s and yes, life would have been hard for her as a single mother. She would have survived it, though... and who knows - I might have had a childhood filled with the security of peace, rather than rows behind closed doors, the skill of walking on eggshells learnt before I even started school, and for a long while the belief that because I was female? It was my "role" in a relationship to be passive. Oh, and also the burden of guilt because my mother still frequently tells me that it's my fault she chose to return to my adulterous father.
Please don't heap any such things onto your children, OP, because they will not be as oblivious to your marriage as you actually believe them to be. They'll know. Children are smarter than they often look. Especially when it comes down to matters concerning their own parents - the people who ought to be putting them first, rather than an outdated, ridiculous notion that martying oneself for them is the way to go...
It's really not.