Super annoying when you get locked out, innit?
It depends a bit how you have installed NextCloud but here are two possible locations for your config file:
/var/www/htdocs/nextcloud/config/config.php ("regular" apache install) /config/www/nextcloud/config/config.php (when using a Docker install)
Open the config.php file and look for
'maintenance' => true,
And change this to
'maintenance' => false,