UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3ODVU4jZ0jnRj+WrBBspp6LezbEYJB3sG73KuqVawiM='
WHERE
key_id = '8b50823bda3efa7f40183493f44a6e7fbd855ad56f10d8c94d5d5d83f0004fc5'
AND (
token = '3ODVU4jZ0jnRj+WrBBspp6LezbEYJB3sG73KuqVawiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)