public static function delete_userkeys(string $script, $userid = null, $instance = null) {
        global $DB;

        $searchparams = [
            'script' => $script,
        ];

        if (null !== $userid) {
            $searchparams['userid'] = $userid;
        }

        if (null !== $instance) {
            $searchparams['instance'] = $instance;
        }

        $DB->delete_records('user_private_key', $searchparams);
    }