UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PAHdWvISeV51y+hI3TQawbUS8Glm1aoK73D2y2W879M='
WHERE
key_id = '017f44d0945be81599edda59cd2332b6dfdd11ccb3e16d849f608c244b238e32'
AND (
token = 'PAHdWvISeV51y+hI3TQawbUS8Glm1aoK73D2y2W879M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)