If you refund an order that used a discount code, the code remains as “used.” It won’t be automatically reactivated for the customer.