Ferritin raised from inflammation is molecularly identical to ferritin raised from food or iron pills. So that number is always an actual number. Remember that serum ferritin is what is measured, and serum ferritin is efflux from ferritin in hepatocytes.
There are two paths to arrive at making ferritin, and the inflammatory one is driven by Interleukin 6. Lack of sleep doesn't raise cytokines, so lack of sleep would not raise ferritin. However, there is a possibility that your initial ferritin measurement of 40 was driven up by some inflammation and later the 34 it had gone down, but here's the thing -- ferritin can only fall if the body take iron from storage. And that happens when you have a low hemoglobin (you don't, you're on TRT) or you have a hepcidin disorder, such as an HFE gene mutation.
I have seen guys get over Covid with ferritin levels in the 400's who are on TRT and the ferritin doesn't fall. Women, sure. But a male on TRT is going to have a hemoglobin of 17 or so. Ferritin driven up by inflammation or iron pills isn't going to drop in a guy on Test unless he loses blood.
If you persistently have a low ferritin at a young age no matter what, even after my protocol, it's a possibility that you carry gene(s) for hemochromatosis. My protocol depends on hepcidin and hepcidin can't go up in hemochromatosis. One guy who did my protocol, and it didn't work, discovered he had hemochromatosis (he was catching it at a young age. By 55-60, iron overload has caused cellular iron deposits, which is why ferritin is high by that age in people with hemochromatosis). Which made sense since the whole thing depends entirely on raising hepcidin.
Overall I would say it's worth getting a check to see if you carry a gene for it, or as has been suggested, it was a variation in measurement. Although Ferritin is an acute phase reactant, it takes 48 hours to move up anyway, a little faster if your RBCs are 7 but I've rarely seen that. You only recycle RBCs so fast. As detailed on my page, iron homeostasis has a lot of moving parts.