UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBIa/nsJMQYSfePsjHIvxqy+ELJ0G/9JaSx6zKXpWF8='
WHERE
key_id = 'da1b103db0abeb3ce493d41294f10b4490e5a7f784a83486dd4820d7cf180544'
AND (
token = 'XBIa/nsJMQYSfePsjHIvxqy+ELJ0G/9JaSx6zKXpWF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)