UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tAw2VkxnMBRti+TSc2jCsqljgEpPY38XZFGjHVT6kl8='
WHERE
key_id = '23a13aa46710b7fcdfa169a89d78d5397e6963ee47da0061754a0fce1fad091d'
AND (
token = 'tAw2VkxnMBRti+TSc2jCsqljgEpPY38XZFGjHVT6kl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)