Is your current filter capable of filtering a 40g?
Heres how I would do it. Not saying its the best however.
Take all fish and place them into bucket(s) of tank water.
Put an inch or so of water in new tank
Get a NEW dustpan or other item to scoop existing substrate up and place into new tank, mixed with the new to cover the additional surface area. The water you added before the substrate is to keep it wet so beneficial bacteria stays good
SLOWLY fill the tank to prevent as much clouding as possible
Add decor
Add filter
Add fish
Go about your day
You should keep a watchful eye over it for the next few days/week though. It may experience a mini cycle and you'll need to do the necessary steps in order to keep that in check