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

Query time 0.00041