Is there an approximate substitute for a Torx T40 bit?
Depending on how many you have and what is at risk ... could fit the T40 screw head socket with the largest possible hex/allen bit, spray the T40 recess with silicone, clean the hex bit, dab some quick curing epoxy or liquid metal into the recess, immediately followed by inserting the bit (only) until cured.