UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A0F13T4JmFmPSyy8UZATNfhnm+25Z7XLU8wsJt9vWzU=' 
WHERE 
  key_id = '35191855ae65b671647d82ad68e47c8a99a9d875577c22e33b31c05436148614' 
  AND (
    token = 'A0F13T4JmFmPSyy8UZATNfhnm+25Z7XLU8wsJt9vWzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047