Fixes expiration time changes after TTL updates 

closes #3923

- ExpirationTimeTest proves this fix.
- Includes various refactorings.