Just keep your head down and remember why you are there. Perhaps you can make a difference. You can leave for a better job after a little time if it feels like the best thing to do.
I just finished the most miserable job imaginable. It was cramped, in a mold infested, windowless building with the most unprofessional, rabid, narcissistic, back-stabbing, hostile people you can imagine. But the work was very real. The kind of work that saves lives. US soldiers lives.
I’d have quit long ago if it hadn’t been for that. But it was fulfilling. I also gained some really great experience and have moved on to a better(career-wise) job.
Best of luck in whatever you decide!