UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rt/PmsATdSl1SGOyY1W70LlBd1d8fpMV134IkObK8kk=' 
WHERE 
  key_id = '639165fa5fa55fd46a2f7335b8085854ad7980dd4f6fab384ab7e75c4813a366' 
  AND (
    token = 'Rt/PmsATdSl1SGOyY1W70LlBd1d8fpMV134IkObK8kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028