UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ENmFVKkq4qyNUnnbsJZhjwL08Y8e9oYuL1SII9sg03U='
WHERE
key_id = 'aea792530a11f6fe808eaab2a92ba1515fdfdd474eb4c6f7b8c3891b42916228'
AND (
token = 'ENmFVKkq4qyNUnnbsJZhjwL08Y8e9oYuL1SII9sg03U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)