Get locked tasks count computed using DB