UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xi1w5zM5cxGYVCU0wf2ZaUM0WLgJvINYDfTfvDKL6X8='
WHERE
key_id = 'b1a62ab258a70ac57ad8915fc9d9554af8c3b4fb122c12c0bc0d4893d77dc391'
AND (
token = 'Xi1w5zM5cxGYVCU0wf2ZaUM0WLgJvINYDfTfvDKL6X8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)