An opening has one job: give the audience a reason to keep listening. Do that by starting with the problem, a specific moment, a surprising fact, or a direct question. Do not open with your credentials, an apology, or housekeeping. Thirty seconds is enough, and it should contain something the audience did not already know.
Only if the joke is about the subject and would still be worth saying without the laugh. A joke that exists to warm the room spends your opening on something unrelated to your argument, and if it does not land you have started from behind.
Around thirty seconds, or two to three sentences. Long enough to establish why this matters, short enough that you reach substance before anyone has decided the talk is not for them.
Let the opening earn the question. Establishing relevance first and identity second is almost always stronger, because credentials persuade people who are already listening and bore people who are not.