UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cQZpsqrH6P7ZHUIHG1RI+MBAYaKGAQQWPnu7heBSIQA='
WHERE
key_id = 'cd37954333d120b8636240b552ff03e51b857e16fa8a42f63555d7fbc74425f9'
AND (
token = 'cQZpsqrH6P7ZHUIHG1RI+MBAYaKGAQQWPnu7heBSIQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)