As Homer and Marge's wedding anniversary approaches, Homer remembers how they celebrated their first one: by visiting an outdoor mall and riding its miniature train, "Li'l Lisa." Homer visits the mall, intending to bring Marge back for this year's anniversary, but finds that it has become a run-down wreck. Taking the dismantled train home, he enlists his bar buddies and Reverend Lovejoy to help him refurbish it. Meanwhile, Marge goes online to order a batch of Dolly Madison snack cakes for Homer, but inadvertently ends up on a site called Sassy Madison (a parody of Ashley Madison), which helps married people set up affairs. She quickly receives a deluge of invitations from perverted men; while deleting them, she finds a message from a likable guy named Ben and starts talking with him. At first she tries to brush him off, but the two soon find that they share an appreciation for the British drama series Upton Rectory (a spoof of Downton Abbey). Homer continues to work on his train project in secret, alienating Marge.
On the day of their anniversary, Homer fakes a back injury and sends Marge across Springfield to pick up a prescription for him. With her gone, he and his friends set up the train to run around the house. As she drives, Marge experiences visions of Ben, mentally pushing them away while bemoaning the state of her marriage at the same time. When she returns home, she sees the train, now renamed "Majestic Marge," and forgives Homer. Ben's wife Ramona confronts the couple over Marge's secret correspondence with Ben, but Homer and Marge explain that two people in a healthy relationship should not keep secrets from one another. Homer decides that Marge does not have to tell him how she came to know Ben, and Ramona tells Ben that the two of them are going to become closer by reviewing his computer browser history, much to his surprise. Ben returns to Sassy Madison and makes contact with a new woman, but runs away screaming when she turns out to be Selma.