UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QiOnVZx5otYL77g6PcyPiVpgBvZTaJoDyj+x+Fzcisw=' 
WHERE 
  key_id = '35a0a9a5c118a87b6d39ca9716395c06064cb9acf4fbf50f43296e0905781262' 
  AND (
    token = 'QiOnVZx5otYL77g6PcyPiVpgBvZTaJoDyj+x+Fzcisw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019