What constitutes consent to marriage?
So there is no doubt about this issue concerning your example: The Marriage would not be considered valid. I am including the whole relevant material from the Code of Canon Law on this subject:
6III. Matrimonial Consent*
1625 The parties to a marriage covenant are a baptized man and woman, free to contract marriage, who freely express their consent; "to be free" means:
1626 The Church holds the exchange of consent between the spouses to be the indispensable element that "makes the marriage."125 If consent is lacking there is no marriage.
1627 The consent consists in a "human act by which the partners mutually give themselves to each other": "I take you to be my wife" - "I take you to be my husband."126 This consent that binds the spouses to each other finds its fulfillment in the two "becoming one flesh."127
1628 The consent must be an act of the will of each of the contracting parties, free of coercion or grave external fear.128 No human power can substitute for this consent.129 If this freedom is lacking the marriage is invalid.
1629 For this reason (or for other reasons that render the marriage null and void) the Church, after an examination of the situation by the competent ecclesiastical tribunal, can declare the nullity of a marriage, i.e., that the marriage never existed.130 In this case the contracting parties are free to marry, provided the natural obligations of a previous union are discharged.131
1630 The priest (or deacon) who assists at the celebration of a marriage receives the consent of the spouses in the name of the Church and gives the blessing of the Church. the presence of the Church's minister (and also of the witnesses) visibly expresses the fact that marriage is an ecclesial reality.
1631 This is the reason why the Church normally requires that the faithful contract marriage according to the ecclesiastical form. Several reasons converge to explain this requirement:132
Sacramental marriage is a liturgical act. It is therefore appropriate that it should be celebrated in the public liturgy of the Church;
Marriage introduces one into an ecclesial order, and creates rights and duties in the Church between the spouses and towards their children; - Since marriage is a state of life in the Church, certainty about it is necessary (hence the obligation to have witnesses);
the public character of the consent protects the "I do" once given and helps the spouses remain faithful to it.
1632 So that the "I do" of the spouses may be a free and responsible act and so that the marriage covenant may have solid and lasting human and Christian foundations, preparation for marriage is of prime importance.
The example and teaching given by parents and families remain the special form of this preparation.
The role of pastors and of the Christian community as the "family of God" is indispensable for the transmission of the human and Christian values of marriage and family,133 and much more so in our era when many young people experience broken homes which no longer sufficiently assure this initiation:
It is imperative to give suitable and timely instruction to young people, above all in the heart of their own families, about the dignity of married love, its role and its exercise, so that, having learned the value of chastity, they will be able at a suitable age to engage in honorable courtship and enter upon a marriage of their own.134
Mixed marriages and disparity of cult
1633 In many countries the situation of a mixed marriage (marriage between a Catholic and a baptized non-Catholic) often arises. It requires particular attention on the part of couples and their pastors. A case of marriage with disparity of cult (between a Catholic and a nonbaptized person) requires even greater circumspection.
1634 Difference of confession between the spouses does not constitute an insurmountable obstacle for marriage, when they succeed in placing in common what they have received from their respective communities, and learn from each other the way in which each lives in fidelity to Christ. But the difficulties of mixed marriages must not be underestimated. They arise from the fact that the separation of Christians has not yet been overcome. the spouses risk experiencing the tragedy of Christian disunity even in the heart of their own home. Disparity of cult can further aggravate these difficulties. Differences about faith and the very notion of marriage, but also different religious mentalities, can become sources of tension in marriage, especially as regards the education of children. the temptation to religious indifference can then arise.
1635 According to the law in force in the Latin Church, a mixed marriage needs for liceity the express permission of ecclesiastical authority.135 In case of disparity of cult an express dispensation from this impediment is required for the validity of the marriage.136 This permission or dispensation presupposes that both parties know and do not exclude the essential ends and properties of marriage and the obligations assumed by the Catholic party concerning the baptism and education of the children in the Catholic Church.137
1636 Through ecumenical dialogue Christian communities in many regions have been able to put into effect a common pastoral practice for mixed marriages. Its task is to help such couples live out their particular situation in the light of faith, overcome the tensions between the couple's obligations to each other and towards their ecclesial communities, and encourage the flowering of what is common to them in faith and respect for what separates them.
1637 In marriages with disparity of cult the Catholic spouse has a particular task: "For the unbelieving husband is consecrated through his wife, and the unbelieving wife is consecrated through her husband."138 It is a great joy for the Christian spouse and for the Church if this "consecration" should lead to the free conversion of the other spouse to the Christian faith.139 Sincere married love, the humble and patient practice of the family virtues, and perseverance in prayer can prepare the non-believing spouse to accept the grace of conversion.
To be crystal clear, the above case would be considered invalid because a marriage tribunal would question the validity of the consent. The Church must be absolutely sure that consent was given. One can not prove without a shadow of a doubt that your above example was done according to Canon Law.
Some unconscious persons may retain their faculties of reason, while others do not. This poses a huge obstacle in establishing whether or not real consent was actually established.
Was the consent truly given? Was the squeezing of the hand really done by way of consent or merely a physical reaction? Thus Rome would not recognize this as a means of valid consent. The dubia is too great.
Another problem is that the unconscious person could not sign his writ of consent, as is mandated by many civil courts. It would not be recognized by the law of the country where they reside.
The above scenario lacks a serious norm of ecclesiastical form from its very concept.