UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ri+7HWJMrn4NXSwUGtpOSHg8U9iPklDxsdXYGrPCQ2E='
WHERE
key_id = 'c6f63b11a28b329cfe594db06e8f657dbb9ce13032f1cbb93ac64866e715bded'
AND (
token = 'Ri+7HWJMrn4NXSwUGtpOSHg8U9iPklDxsdXYGrPCQ2E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)