integration refactoring

This method contains the same logic as TokenRepository.getNotExpiredToken