This quote is from The Rape of Lucrece, which is a narrative poem by Shakespeare, not a play. The quote is uttered by the character Tarquin, a soldier. Lucrece is the wife of Collatine, a friend of Tarquin. Collatine brags about how chaste his wife is, and this incites desire in Tarquin, who rapes Lucrece. Lucrece later kills herself. Tarquin utters this quote while he is trying to decide whether or not to give in to his passion and rape Lucrece. The entire quote is:
What win I, if I gain the thing I seek? A dream, a breath, a froth of fleeting joy. Who buys a minute's mirth to wail a week? Or sells eternity to get a toy? For one sweet grape who will the vine destroy?"
Shakespeare’s poem is based on a story found both in Ovid’s and Livy’s histories of Rome. Tarquin was king of Rome in 509 BC when he raped Lucretia, wife of Collatinus. The incident caused a revolt against Tarquin, the royal family was banned from Rome and Rome supposedly became a republic after this.