UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xUePhyAiBzgfmwXi+UTyTrtWQretGa4JqFbILeGXKlw=' 
WHERE 
  key_id = '336df7cb15cdb9ad23943e425ed04f87184131e41a1e66d1569dbb9361dc3039' 
  AND (
    token = 'xUePhyAiBzgfmwXi+UTyTrtWQretGa4JqFbILeGXKlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047