I’d suggest you to temporary enable the “Pause Cloudflare for this site” option from the bottom-right corner of the CF dashboard → Overview.
Upon success and once finished, un-pause and continue working.
It’s likely the script/process takes longer than Cloudflare’s default 100s timeout, which is why you’re experiencing 524 error.
Regarding 520, might be Cloudflare isn’t allowed at the origin host, or IPs are blocked, or something else in the meantime related to the HTTP(S), or xmlrpc.php or similar file is being restricted to work with that particular plugin like sometimes REST API can be or even WP-cron.