Adds ability to check if token will expire before given time

[#787407]