Wal-Mart has booked an increase in first-half earnings but lowered its full-year sales and profit guidance on the back of a "challenging" operating environment.