UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Va0jj2wbGs4cVfydBAEqWO1x7XGBporWLE3CIYIk9qo='
WHERE
key_id = '0134adc1b5a95e1f17345b263173a9aadaede54926a9bdbf7a38fb9a167ba297'
AND (
token = 'Va0jj2wbGs4cVfydBAEqWO1x7XGBporWLE3CIYIk9qo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)