UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W37z3mEavaBsXbdGlVDhxNxaqBMaaINHmYruHSdEO9U='
WHERE
key_id = '7ae186e9a9813c87a5a1881144fd1825f628f4d92d38f26d5e5858c192b3b2f1'
AND (
token = 'W37z3mEavaBsXbdGlVDhxNxaqBMaaINHmYruHSdEO9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)