Are you using the Forgot Password module from the marketplace or implementing your own forgot password logic? I would recommend you to use the former as implementing your own logic can introduce a lot of security issues.
The forgot password module already has an expiration of 30 minutes build in and deletes the link after the password has been changed. If you want to expire the link already after clicking it, you could create a copy of ForgotPassword.Step3_DL_SetNewPassword in your own module e.g. named ForgotPasswordExtension, set the expiration date of $ForgotPassword variable to the currentDateTime and commit that change. Creating a copy in your own module is required so that you won't overwrite your changes when updating the module. Also when updating the module, make sure you add changes to ForgotPassword.Step3_DL_SetNewPassword that may be introduced in the update to your copied SetNetPassword microflow.