Study of the K ±→π ±γγ decay by the NA62 experiment