UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+QCpHi480+DWrU+PPY6m3w7XRMV0q5h8JhCbOhXUYqc='
WHERE
key_id = 'cee4787403b261961f9fa193ffa75ce860ff8d585bb340cf61060fabcac1b0cd'
AND (
token = '+QCpHi480+DWrU+PPY6m3w7XRMV0q5h8JhCbOhXUYqc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)