UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lyelV5vjudjsy1GcOB+LWG2pg2kVErj23XLK0QukSww='
WHERE
key_id = '223d01a089a057218ccab69354bd5bcb37b9642b92280ae4af3a17dbc0ec5de6'
AND (
token = 'lyelV5vjudjsy1GcOB+LWG2pg2kVErj23XLK0QukSww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)