def METHOD_NAME(user_social):
    """
    Utility function to refresh the access token if is (almost) expired
    Args:
        user_social (UserSocialAuth): a user social auth instance
    """
    try:
        try:
            expires_at = user_social.extra_data.get("expires_at")
        except Exception:
            _send_refresh_request(user_social)
            return
        current_time = int(time.time())
        if current_time >= expires_at:
            _send_refresh_request(user_social)
    except Exception as ex:
        logger.error("Failed to refresh token: " + str(ex))
        raise ex