zulfikri As stated in Spinebot's answer, there is no feature to lock the first and last keys. However, by using the Graph view, you can quickly see if the key values in the first and last frames match. In Graph view, when the loop button is enabled, the connection of the curves during looping is dimmed:
If the curve is correctly connected both before and after the loop, it will look like this:
So I recommend using the Graph view.
For your information, although there is no key lock feature, you can protect bones whose animation you do not want to edit by hiding them in the Tree view, since hiding a bone prevents the timeline for that bone from being displayed in the Dopesheet or Graph view, and also prevents key selection.