UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IP0ZrifjGKo0RkkTUekL6+fGrWEIYFia2fMRNcSFeMY=' 
WHERE 
  key_id = 'c25b938838e1cedd96980e7cee23d8bacc291671bda81cb7cec42b764f800875' 
  AND (
    token = 'IP0ZrifjGKo0RkkTUekL6+fGrWEIYFia2fMRNcSFeMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050