If your bike came with those ring sizes, it probably has one of the trekking type front derailleurs. Find its model number on the back side of the cage and look up its specs to corroborate. Using this type of FD with a 40, 42, 44 etc will create excess gap with the cage that may result in chain drop and/or mediocre shifting. To avoid this, switch to a non-trekking 11s triple Shimano mountain FD.
If 30/40 is what you're after, double check compatibility for the FD in question with the minimum middle to large difference spec. Your resource for those numbers is si.shimano.com.