I believe I know what you were talking about, as I’m an assistant professor in a research university. I have the tendency to overthink and to be lost in thoughts, which gives me a lot of stress.
The best way is to learn to meditate. Go to a Chan temple to learn and obtain guidance from competent teachers.
Meditate at least for one hour each day. It is very helpful for you to meditate in the morning before going to work. It will energize you for the day.
At work, if you find yourself mentally exhausted then cross your legs until you recover: to continue spinning your brain would be rather unproductive. As you develop real Chan skills you will automatically meditate for 5-10 minutes at periodic intervals in the office to keep your head clear and your productivity high.
In short, keep up with your Chan practice with the unrelenting goal of improving your mediation skills so as to maintain your mental health and productivity.