UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XJfDvTN70OazklLD4oUo1XOYOY6IDSNp4Tfxdaqc+IQ='
WHERE
key_id = 'f9c4e86f3760af28869e7b317cef336f6b541a72e147fb75af7a56298ada4bf4'
AND (
token = 'XJfDvTN70OazklLD4oUo1XOYOY6IDSNp4Tfxdaqc+IQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)