public static function retrieveOrCreateToken(Model $user, $ipAddress)
    {
        try {
            $token = self::findFirst(new AndGroup([
                new Equals("AuthenticatedUserID", $user->UniqueIdentifier),
                new Equals("IpAddress", $ipAddress),
                new GreaterThan("Expires", "now", true)
            ]));
            $token->Expires = ApiSettings::singleton()->tokenExpiration;
            $token->save();
        } catch (RecordNotFoundException $ex) {
            $token = self::createToken($user, $ipAddress);
        }

        return $token;
    }