UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1xrtywpZHHMM2Gxo3XI96lMXgAzK0JItCKjFxWaofy4='
WHERE
key_id = '1dd3885e80cf773d0978bf8ea4fd759f225d2acb16d8a3011287c72b401e6693'
AND (
token = '1xrtywpZHHMM2Gxo3XI96lMXgAzK0JItCKjFxWaofy4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)