UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrJs+V4DUczNLJ3uYjZvEiSal25LhwLozI8avc0uFbc=' 
WHERE 
  key_id = '469462ef93a9fdae23698e086cca7891dc590576d48b55036832849c92f8ed66' 
  AND (
    token = 'yrJs+V4DUczNLJ3uYjZvEiSal25LhwLozI8avc0uFbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036