UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xnxFyVt9OOgp8EPJzrVfq+amxjzV7yyJ507dbjfTmZI='
WHERE
key_id = 'fd638b1c4e430ffcd5017da6ad9addd356694f017205a0ff05c76c13e2187ef4'
AND (
token = 'xnxFyVt9OOgp8EPJzrVfq+amxjzV7yyJ507dbjfTmZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)