If the difficulty of a world is locked, it can still be changed with /difficulty command BUT when you use that command to change it, the difficulty in the Options menu doesn't update along with the command.
When you leave and re-enter the world it will change.
Steps to reproduce:
1. create a new world
2. lock the difficulty on Peaceful
3. do /difficulty easy
4. the Options menu still says it is on Peaceful (incorrect)
5. Save and Quit to Title and re-enter the world
6. now the Options menu says its Easy (correct)
I have tested this it changes it to easy.