This Script will give list of all the eligible Points that have same attribute as spatially intesected Polygons. Further, you can pass this into definition query/select by attribute in point fc.
import arcpy
#Specify Deafult workspace for this script. it helps in - 1)all geoprocessing Output will created in this gdb. 2) you can specfiy fc with double quotes rathar than spcifying full path
arcpy.env.workspace = r"C:\Users\Sanjay\Documents\ArcGIS\SimilarPoints by attribute in polygon\mygdb.gdb"
#Set Output true to replace
arcpy.env.overwriteOutput = True
#best practise say to use makefeaturelayer rathan spcifying fc name.
arcpy.MakeFeatureLayer_management("Point","PointLayer")
#Lets do Spatial join get all intersected points with all attributes of pplygon attached
arcpy.SpatialJoin_analysis("PointLayer","polygon","SelectedPoints","JOIN_ONE_TO_ONE","KEEP_ALL")
# #best practise say to use makefeaturelayer rathan spcifying fc name.
arcpy.MakeFeatureLayer_management("SelectedPoints","SelectedPoints_lyr")
#where clause to be used where ID from points and poly will match -ID for Poly fc, ID_Point is Point Fc
sql_exp = """ID_point = ID"""
#Select by Attribute from Spatial joined FC
arcpy.SelectLayerByAttribute_management("SelectedPoints_lyr", "NEW_SELECTION", sql_exp)
#Lets find out what are those points features has same attribute as polgon and falls into polygon
field = 'ID_point' #Specify field to extract list of id
values = [row[0] for row in arcpy.da.SearchCursor("SelectedPoints_lyr", field)]
uniqueValues = set(values)#Set to get Unique id which need
print "this are ids from point fc that has same attr. and spatially located in polygon"
for item in uniqueValues:
print item