UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uPouxuIEAIuc9JBxcOYaqUYQSFDeUFBxGO2ePacYus=' 
WHERE 
  key_id = '3a3b5dff6deef5e21888ce425f2928fa26b5b53db503f8c9ce5e9b1d36add241' 
  AND (
    token = '0uPouxuIEAIuc9JBxcOYaqUYQSFDeUFBxGO2ePacYus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029