If you're not, you'd probably stay for the severance package, and do absolutely no work in the meantime. No company or recruiter will be holding the fact you were fired against you if/when you're swept away in the layoffs.
If you genuinely like your job there and don't feel strongly about Musk either way, that's probably the toughest situation, and you should come to terms with the fact that even if you keep your job at Twitter it will likely feel like an entirely different workplace in a couple months.