There are a few things you can try:
Substrate:
-Cypress Mulch
- Coco Husk
Both of these retain humidity really well
Tank lid:
- Put a damp towel over 60-90% of the lid
- Cover 80-90% of the lid with tin foil or plexiglass.
Inside the tank:
- Use a larger water dish (surface area = greater water evaporation)
- Move the water dish to the hot side of the tank
- Good old fashion misting with a spray bottle
-Use a humid hide if everything else fails. (Get a plastic tupperware and put some damp moss or paper towel inside. Cut a little hole in the lid so the snake can go in and out as it wants. The humid hide provides a 'humid spot' rather than trying to make the entire 40 gallon tank humid.