Yes, using a tent lock is an excellent way of securing the door to your tent from the inside. Although tent walls and doors can be easily accessed, the vast majority of intruders and thieves are looking for easy access. If they are met with resistance, it is likely that they will be deterred in fear of being spotted in a busy campsite and instead will look for an easier target.
However, you should never advertise the fact you’re using tent locks as instead of securing your tent, this may signify to thieves that you have valuables in your tent. As a result, you should try to secure the door from the inside as opposed to the outside, as a tent lock on the outside is likely to give thieves the impression that there is something worth stealing in your tent.