UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6nCd+A+RECqIkKk2VoH9FkIdBv5QFDQLQ+navqbD9gg='
WHERE
key_id = 'cdc043816f4f4d4102828421d12b2ac22ed6545b00f483e6678db7d2e8e55c74'
AND (
token = '6nCd+A+RECqIkKk2VoH9FkIdBv5QFDQLQ+navqbD9gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)