UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'baGWucOmK9g6XVzu4TaZ+ck4YbOM5ga3YFJ7IZKWTns=' 
WHERE 
  key_id = '8005f9ce5e5b92ac2711c215815a467256073a32ccac2f84910d32149d5fe190' 
  AND (
    token = 'baGWucOmK9g6XVzu4TaZ+ck4YbOM5ga3YFJ7IZKWTns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036