UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v6RwovtYgiAqXZJKnTTsxuOP+BWwVFOWmaUjQ9028b4='
WHERE
key_id = 'ccd8401b175abefd730a2eed845fa3f98f0fe891793abc819864a2caa0f72c1a'
AND (
token = 'v6RwovtYgiAqXZJKnTTsxuOP+BWwVFOWmaUjQ9028b4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)