UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G0ETf4eO+ozfueIyyulmijj/W9+qqh3LfvjreOoo7xs=' 
WHERE 
  key_id = '356ff18c88c3edd7ced5f350b333283dedea0746dcfb72043babfa9f6b4fbbdb' 
  AND (
    token = 'G0ETf4eO+ozfueIyyulmijj/W9+qqh3LfvjreOoo7xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029