UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5v7TGHpwlPLFEcLgh6ThqBQWvwzOhQeu2XO9mRW8Ufk='
WHERE
key_id = 'afb0b50a1b91fb425b02d27e8af3527f0ede4ad0f79df87cbbb9a703a73bb5fb'
AND (
token = '5v7TGHpwlPLFEcLgh6ThqBQWvwzOhQeu2XO9mRW8Ufk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)