Quick answer:
It doesn't matter. The recommended engine oil for your engine wouldn't be near the edge of what your bearing clearances could tolerate, so going a little up or down from that isn't going to affect anything. 10W30 and 10w40 are very close to one another in terms of behavior.
Explanation/showing of work:
The main purpose of oil is to lubricate the metal parts of the engine as they move against one another. The oil is pressurized by a pump and fed through oil passages to spaces between all the moving parts. These spaces are surrounded by bearings that are supposed to ensure an exact spacing between the parts. For example, as your crankshaft rotates and the connecting rods move up and down, there are bearings between the block/main caps and the crankshaft and bearings between the crankshaft and the rods. The purpose of the bearing is to trap a specific amount of oil at a specific temperature and viscosity between the two moving parts so that they don't touch one another.
Going to a slightly higher viscosity will actually offer a slightly better protection at the cost of slightly increased pumping and shearing losses (because the oil is thicker and doesn't flow as easily). The risk is that if you go to an extremely high viscosity, the pump won't be able to push the oil through the bearings to lubricate properly. So don't put 120W oil in your engine.
But 10W30 vs 10W40 might as well be the same for all intents and purposes here. They behave the same at low temperatures. The only difference between them is that 10W40 is slightly thicker when the engine is warmed up.