UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9syIKYeD4J6KBY5yZ9C33hkMEgh5byWXzWySyBBp48M='
WHERE
key_id = '9178e35f9732c937dadab5b9b91cb4aadd06efea931b30148a456bd200ed1318'
AND (
token = '9syIKYeD4J6KBY5yZ9C33hkMEgh5byWXzWySyBBp48M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)