Higher prices and more premium products were a boon for snack and beverage giant Pepsi in the second quarter.