UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5JnlKwtq+kQ9bQSOWUr7+L4cE9WhgInB8rd4Vt+pDw=' 
WHERE 
  key_id = '36f7b518220c856cf508e0eeba1f8f5a1d4ca0967654e715f80cfc4147ca0e75' 
  AND (
    token = 'v5JnlKwtq+kQ9bQSOWUr7+L4cE9WhgInB8rd4Vt+pDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035