UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dFTS3a4MoUJ1OUXdTAPbflV/qtUnMKyCbD+U04oCKwQ=' 
WHERE 
  key_id = '79c4757cee539ee433f902c840201553d9f0ac1cfd92c74f09d17288185f057b' 
  AND (
    token = 'dFTS3a4MoUJ1OUXdTAPbflV/qtUnMKyCbD+U04oCKwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029