UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sW2m6GS3yTcH7XHFWA2+2xXhYhOzcaGpZi89FjVw2ic='
WHERE
key_id = '8caf166270ad63bded3a802b27a4b2b3ada0063909ee8a25117ae10b14e3b8a2'
AND (
token = 'sW2m6GS3yTcH7XHFWA2+2xXhYhOzcaGpZi89FjVw2ic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)