UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nUAEZyuYFtT7TmIp1Br71Z7qAIdqjMfoZRRm+/Oe3xA='
WHERE
key_id = '0afc1ae52bfb51d91bc96f22b2b421b5d27faff638f3697a22eb922282935ace'
AND (
token = 'nUAEZyuYFtT7TmIp1Br71Z7qAIdqjMfoZRRm+/Oe3xA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)