Renew token before expiry time

Modify is_expired so that token is renewed before it
actually expires. The threshold is set to 60s, which is plenty
of time for any API call to complete.
Use utcnow() instead of utc(). Includes unit tests for is_expired.

Closes bug 1292145

Change-Id: Ic062b4352612c936d1f83fcb7cb09154eb628d9e
2 files changed