UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ve78tvfyEI6ymdl7cAhZ6tp86nbnUGx65PEsyAX15J8='
WHERE
key_id = '2b92d45b84c723b907b67c745846eb660b0ffd5e0af8f2b5fb40a386e9948529'
AND (
token = 'Ve78tvfyEI6ymdl7cAhZ6tp86nbnUGx65PEsyAX15J8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)