To construct the script you could use Pieter Wuille's Miniscript site.
If you go to the Policy to Miniscript compiler section there is an example in Policy for a 2-of-2 multisig that turns into a 1-of-2 multisig after 90 days.
You would need to adjust it for your desired example. A Policy that fits your needs would be:
Once you have the Policy you can copy and paste this into the Policy to Miniscript compiler section and get the Miniscript equivalent of this Policy. The Miniscript output is:
Further down you can copy and paste this Miniscript in, press Analyze and you will get the size of the resulting Script (78 bytes) as well as the actual Script:
<key_1> OP_CHECKSIGVERIFY <key_2> OP_CHECKSIG OP_IFDUP OP_NOTIF
It is worth noting that this example assumes you are more concerned with losing one particular key (
key_2 in this example) and you assume will still have access to
key 1. If you are just as likely to lose either key (
key_2) you would want a different script.
I recommend you try this on testnet or Signet first where coins aren't worth anything. Alternatively with a small amount of funds on mainnet that you can afford to lose. You don't want to be losing all your funds due to a mistake or a misunderstanding.