UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mO1mZRO3gHkhWt03jBq0evvRuCpjPcaw9Mm+ws5nXY0=' 
WHERE 
  key_id = '74c37c308e713e2dd910a1273a4f572e77951d1bf1840c911d5eb9b29ec8ae42' 
  AND (
    token = 'mO1mZRO3gHkhWt03jBq0evvRuCpjPcaw9Mm+ws5nXY0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077