Better expiration handling in CachedThreadScheduler

- Lower maximum time spent looking for a non-expired event loop

- Keep timestamp calculations to a minimum