def METHOD_NAME(self):
    validity_period = getattr(settings, "DEFAULT_TEMP_TOKEN_EXPIRY_TIME")
    time_to_subtract = validity_period + 1
    user, created = User.objects.get_or_create(username="temp")
    temp_token, created = TempToken.objects.get_or_create(user=user)
    expired_time = temp_token.created - timedelta(seconds=time_to_subtract)
    temp_token.created = expired_time
    temp_token.save()
    self.assertRaisesMessage(
        AuthenticationFailed,
        "Token expired",
        self.temp_token_authentication.authenticate_credentials,
        temp_token.key,
    )