UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tLolq7YosIhVmOXvmkkYeVvyymkPBHS6AFGKOn5FJNw='
WHERE
key_id = '52fc7d42dbaa0e89ddc850bb8379bb5deafe9f7287a87bbf174f5d6941d1b4c6'
AND (
token = 'tLolq7YosIhVmOXvmkkYeVvyymkPBHS6AFGKOn5FJNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)