UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N6WRhFgluYjK9jKEtuaUwDr2ze3JPLhcBZUIl2NZVD0='
WHERE
key_id = '8f0ec6eee3ab9c69426e4c32c222b9bbb93f22fcd618fe4f03b66ade91a3b663'
AND (
token = 'N6WRhFgluYjK9jKEtuaUwDr2ze3JPLhcBZUIl2NZVD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)