Depends where you put it.

Directly against the lock gates itself and deep in the water where it would be confined then yes. If you put it on a ship in the lock then maybe yes, maybe no. Explosives will vent upward toward the path of least resistance and might not provide enough pressure against either the gates or against the reinforced concrete walls to do major damage.