UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TCKOXHHrWPGVZ0knFOzhA0fpf1vYnedDxNiBt3vFj8Q='
WHERE
key_id = 'adae0b2dddea35e127ff8d6915511155453aa661f04d4186fecbea1b02f0ad58'
AND (
token = 'TCKOXHHrWPGVZ0knFOzhA0fpf1vYnedDxNiBt3vFj8Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)