UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HQPPY2vBeY7kUqNkLpoVwAc1iuebDGlW/jfVtg5evlU='
WHERE
key_id = 'ff180c33f656748f76f671d8be2e97f7218692e30b14da516be64237253104b2'
AND (
token = 'HQPPY2vBeY7kUqNkLpoVwAc1iuebDGlW/jfVtg5evlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)