def METHOD_NAME(
    user_token: model.UserToken, expiration_time_str: str
) -> None:
    assert user_token
    try:
        expiration_time = rfc3339_parser.parse(expiration_time_str, utc=True)
        expiration_time = expiration_time.astimezone(pytz.UTC)
        if expiration_time < datetime.utcnow().replace(tzinfo=pytz.UTC):
            raise InvalidExpirationError(
                "Expiration cannot happen in the past"
            )
        user_token.expiration_time = expiration_time
        update_user_token_edit_time(user_token)
    except ValueError:
        raise InvalidExpirationError(
            "Expiration is in an invalid format {}".format(expiration_time_str)
        )