UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/nOMhPpE+w6S0nLJ2t6OqA3sUTi/XSX8zhyQ7NO2Rg=' 
WHERE 
  key_id = '97a0e16771c062f82d3c0145df3c72ea13e94774237f2908dfc3c03d21e853bd' 
  AND (
    token = 'K/nOMhPpE+w6S0nLJ2t6OqA3sUTi/XSX8zhyQ7NO2Rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045