The 10W-40 and the 10W-30 are both what are called multi-weight oils. The number with the W is called the winter weight; the number after is the summer weight. The oil is measured at 0 degrees and at 212 degrees for each respective number. The higher the number, the thicker the oil at that temperature.
So, both oils are the same viscosity at low temperatures. However, the 40 weight is slightly thicker at higher temperatures. In a low-tolerance engine, the thicker weight is generally not needed because the distance between the parts is smaller, creating a seal that enhances lubrication. That said, if you are running at higher temperatures, then the 40 weight will not break down as quickly. In fact, at a higher temperature, the 40 weight oil will be the same thickness as the 30 weight at a lower temperature. But at equal temperatures, the 40 weight will be thicker and will require more force to move.
If your engine overheats, the 40 weight will protect it longer before breaking down. But under normal operating conditions for our engines, the temperature is controlled by the cooling system to not get too hot, no matter how hot it is outside. So I would stick with the 10W-30, but I doubt that you would really hurt anything by going to the 40 weight.