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

Query time 0.00036