private MutableState createMutableState(final TokenResponse tokenResponse,
                                            final JwtClaims jwtClaims) {
        try {
            final Instant expireTime = Instant.ofEpochMilli(jwtClaims.getExpirationTime().getValueInMillis());
            final Duration timeTilExpiry = Duration.between(Instant.now(), expireTime);
            final long timeToExpireMs = timeTilExpiry.toMillis();
            final long expiryBufferMs = Math.max(MIN_EXPIRY_BUFFER, (long) (timeToExpireMs * EXPIRY_BUFFER_FRACTION));
            final Instant expireTimeWithBuffer = expireTime.minusMillis(expiryBufferMs);

            LOGGER.debug("Updating refresh time - " +
                         "expiryTime: {}, timeToExpire: {}, expiryBufferMs: {}, refreshTime: {}",
                    expireTime, timeTilExpiry, expiryBufferMs, expireTimeWithBuffer);

            return new MutableState(
                    expiryBufferMs,
                    expireTimeWithBuffer.toEpochMilli(),
                    expireTime.toEpochMilli(),
                    tokenResponse,
                    jwtClaims);

        } catch (MalformedClaimException e) {
            throw new RuntimeException("Unable to extract expiry time from jwtClaims " + jwtClaims, e);
        }
    }
@return The time the token will expire (with a small buffer before the actual expiry included)
stroom-security/stroom-security-common-impl/src/main/java/stroom/security/common/impl/UpdatableToken.java