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