UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ml8v5sPWtctQLkDfXLnaiu8KX4RgN4lKTXnQdOtHZMM=' 
WHERE 
  key_id = '04ea79703c268758d84bffcdcf231d97ad4a010b583b09e047ab0e13df9c7939' 
  AND (
    token = 'Ml8v5sPWtctQLkDfXLnaiu8KX4RgN4lKTXnQdOtHZMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042