I had my first midlife crisis in my late twenties and early thirties. Seriously. When things are bad or hard its easy to believe they will always be that way but that's just an illusion. In 1860, at age 38, Ulysses Grant was reduced to working for his father in a saddle shop having failed at just about everything else. By 1861 he was a general in the Union Army.
I try to get through tough periods in three ways: First, although cliche, I live one day at a time. Today is the only day you are responsible for living. Second, I work, even in small ways, on an "escape plan". In other words I try to have a plan that will get me out of whatever trap I think I'm in and I work on little bits of it every day. It may not pan out, but it makes me feel more positive and that in and of itself can bring change. Third, I count my blessings. When I do, I end up feeling rich.
Best Wishes to you.