UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6JK9xVwmfwjv357NXwY2FtA0nRYBdcVrRzd4h+JiGb8='
WHERE
key_id = '098be3ed2b89a372ffac0d720a19f1efd054a8b261f68f48c5d752d38b3291cb'
AND (
token = '6JK9xVwmfwjv357NXwY2FtA0nRYBdcVrRzd4h+JiGb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)