UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g6MjwDGX8RW0vGqKaQngiOAIpN0oiRf5SKDVjZTpNsM=' 
WHERE 
  key_id = 'c994eb3880cde5cf854636f87f402dc107d9a083574c9807684404f8e4e23d1b' 
  AND (
    token = 'g6MjwDGX8RW0vGqKaQngiOAIpN0oiRf5SKDVjZTpNsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027