A NodeMCU would be perfect for this. It is a small form factor, is cheap to purchase and contains an ESP8266 WiFi chip. I have already made a few spoofed WeMo devices using this microcontroller to control things in my smart home set-up. I will write the code to handle the logic to do activate those 2 relays in the manner you would like. I can provide the code and parts list, or I can purchase, ship, and expense to you.