UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9SDOLvijjVRJz9n4x7Qw0U74ENCkd+8SiXREieIUThk='
WHERE
key_id = 'b24652ed1b38880922c8e91b6cc0234cff8dc2472292c7677762729945af6427'
AND (
token = '9SDOLvijjVRJz9n4x7Qw0U74ENCkd+8SiXREieIUThk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)