UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y4lvYKkuLb0Yz4wj+QOq6oaOJ98WLoJ8IX2TEoGCjUs=' 
WHERE 
  key_id = 'b18c6b058051ed8cdf155ac1f0af7a03c542da4e21a711ab0d9f1b2f951466b9' 
  AND (
    token = 'Y4lvYKkuLb0Yz4wj+QOq6oaOJ98WLoJ8IX2TEoGCjUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00081