UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TygCmq72dzBFX5nZbPSIyL2yOv7zFPjghLiHPa9ydu8='
WHERE
key_id = 'fe6a1b9d442de20489b4e539c499cd9ab7788deb9f63f1be3c6217c4b4922079'
AND (
token = 'TygCmq72dzBFX5nZbPSIyL2yOv7zFPjghLiHPa9ydu8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)