Note that maapi_lock/unlock does not lock CDB itself, rather it control write access to the datastore (CDB or external DB) from northbound agents, e.g. MAAPI, NETCONF, CLI etc. See ConfD UG “Global locks”
Regarding the error message, from the confd_lib_maapi(3) man page:
If confd_errno is CONFD_ERR_EXTERNAL it means that a callback has been invoked in an external database to lock/unlock which in its turn returned an error. (See confd_lib_dp(3) for external database callback API)