UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9u+VXfem2RhhBupHMyMxpptwUwwgrtKWFKv6+xXcqw='
WHERE
key_id = '23d17aadc31b4ae062c2c768eab2f00acb50b7e308d7ac5d4bdae48483255bb7'
AND (
token = 'G9u+VXfem2RhhBupHMyMxpptwUwwgrtKWFKv6+xXcqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)