20-40 seconds? That's not enough time for a full context switch.
Take an eye break (look at something more than 20 feet away). Stand and stretch your back. Do a few desk-friendly stretches or exercises (curls, squats). Go to the kitchen for a beverage refill.
Somewhere around the 5 min mark for a wait it becomes time to check email, etc.