You need to get her an adequate
UVB light immediately, and get rid of the sand immediately. First off, the humidity being 40% is absolutely fine, it could be 60% and be fine for a bearded dragon. Humidity is not at all a big deal for bearded dragons, it can range from 20% to 70% and be fine. So that is not the issue at all, and the sand is only going to either cause an impaction because they lick everything, and if it's Calcium Sand or any kind of Reptisand, which is the same thing, it can be immediately lethal. Sand also harbors bacteria, fungi, and parasites, so if that happens to be what her problem is, like she has parasites, the sand will cause her to keep reinfecting herself. So please, immediately get that sand out of there, it's only going to cause additional health issues she doesn't need right now since she's already stopped eating. Dump the sand, be sure to disinfect the tank, and then just put down clean, dry paper towels and replace them as they get soiled. Keeping her tank very clean right now is important, and the sand is counterproductive.
The only compact (regular, lightbulb shaped)
UVB bulb that is adequate for a bearded dragon is going to be a 26 watt UVB compact bulb, like the Exo Terra one. However, if you have a large enclosure like a 40 gallon, you really need to buy a long UVB tube, either an 18" or a 24" long UVB tube, that is a 10.0 UVB tube (never a 5.0 or a 2.0, they are very weak). And I'm sorry, but the brand All Living Things is PetSmart's house brand, and is made in the same factory in China as all the other cheap light brands like ReptileOne and the endless others that often cause eye damage because the lights emit harmful rays due to the cheap manufacturing process. So not only is a 13 watt UVB totally inappropriate for a bearded dragon, it's a compact bulb, which only focuses the
UVB light straight under it instead of all over the tank, and it is a cheap bulb that can actually be harmful. Combine all of these things with the fact that you probably have the already too weak 13 watt
UVB bulb sitting on top of a mesh lid, which is blocking between 30%-50% of the already too weak
UVB light, and your beardie has not been getting hardly any
UVB light at all, which has finally caught up with him, hence the lack of appetite. Soon he will also become more and more lethargic, and then the calcium deficiency will start causing issues, because without proper
UVB light for 13-14 hours every single day, a bearded dragon cannot manufacture vitamin D3, and thus cannot process and absorb any calcium they are eating in their food or supplements you're giving him. This is the normal process that happens every time someone uses an inadequate
UVB bulb and their bearded dragon is not getting adequate, if any UVB and UVA light.
For that size tank you need to buy either an 18" or 24" Reptisun brand 10.0 T8 or T5 High-Output UVB tube, or an Arcadia 12% T5HO UVB tube, and a matching length, long tube fixture to hold it. If you buy the weaker Reptisun 10.0 T8 UVB tube then it must absolutely be mounted under the mesh lid using either 3M Command Hooks or something similar, or by poking holes in the mesh lid and using large zip ties to strap the long tube fixture to the underside of the mesh lid. The T8 UVB tube must also be within 6-8" of his basking spot, and must be replaced every 6 months at a minimum because they stop emitting any
UVB light at that point, even though they still turn on and light up. If you buy an 18" or 24" Reptisun 10.0 T5HO UVB tube or the Arcadia 12% T5 UVB tube, they can sit on top of the mesh lid because they are strong enough to penetrate the mesh and still deliver adequate
UVB light to your beardie, but they must still be within at least 11" of his basking spot, and they must be replaced once every 10 months to a year at a minimum because that's when they stop emitting any
UVB light at all. YOU ALSO NEED TO MAKE ABSOLUTELY SURE THAT WHATEVER LONG, TUBE FIXTURE YOU BUY FOR THE UVB TUBE DOES NOT HAVE A CLEAR, PLASTIC SAFETY COVER ON IT THAT COVERS THE UVB TUBE, THAT WILL BLOCK ALL THE
UVB LIGHT AND MUST BE REMOVED FROM THE FIXTURE BEFORE SETTING IT UP...ALSO, THE FIXTURE MUST HAVE EITHER A BUILT-IN REFLECTOR BEHIND WHERE THE UVB TUBE FITS TO REFLECT THE
UVB LIGHT THROUGHOUT THE TANK, OR YOU MUST ORDER OR BUY A SLIP-ON OR CLIP-ON UVB TUBE REFLECTOR THAT IS THE SAME LENGTH AS THE UVB TUBE YOU BUY. MOST LONG TUBE FIXTURES HAVE A REFLECTOR BUILT-IN, BUT YOU MUST CHECK.
Your other
UVB light option is to buy either a MegaRay or a PowerSun Mercury Vapor Bulb (MVB), which are all-in-one bulbs that act as both the
UVB light and the basking/heat light, so you would no longer need the higher wattage basking bulb you're using now, though often times for a larger tank you will need a secondary lower wattage, bright white basking light over the Cool Side of the tank to get the temperatures within the correct ranges. MVB bulbs fit into a regular fixture, but you cannot use a deep dome fixture for one, it must be a clamp lamp or open dome fixture with a round reflector surrounding the MVB bulb so it gets reflected throughout the tank. The MVB lights must be replaced every 10 months to a year because they stop emitting any
UVB light at that point. The MegaRay is the best MVB light from what I've read and seen.