Move into useful and growing areas, and when they become useless and stagnant, then move somewhere else. Change is the only constant; be on the right side of it.
Leaving a toxic environment makes it less toxic for everyone else. Even the worst bosses will respond to the fact that people are walking out the door and nobody is walking in.