UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgipU8TbLu+HKX8u9rka12ECN8zwfxbiQ80PO89aees=' 
WHERE 
  key_id = '3dd82fa6b696c23bc7aaa63fe6f21b37ef6417f17856429537973030759c2cab' 
  AND (
    token = 'EgipU8TbLu+HKX8u9rka12ECN8zwfxbiQ80PO89aees=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023